Changed 'pixbuf' variable to 'art_pixbuf' in the core function.
authorCody Russell <bratsche@src.gnome.org>
Sun, 10 Oct 1999 07:20:37 +0000 (07:20 +0000)
committerCody Russell <bratsche@src.gnome.org>
Sun, 10 Oct 1999 07:20:37 +0000 (07:20 +0000)
Core function now determines whether the requested geometry is on screen
or not. If part of it is not then the request is clamped to geometry that
is on the screen.

gdk-pixbuf/ChangeLog
gdk/gdkpixbuf-drawable.c

index 98ab859ea3f71e3b5f5325e9f38d96590e7127ae..a07c218f4efd658fa4463c3109f4f3985f7b72c1 100644 (file)
@@ -1,3 +1,10 @@
+1999-10-10  Cody Russell  <bratsche@dfw.net>
+       * src/gdk-pixbuf-drawable.c: core function now determines whether
+       the requested geometry is on screen or not, and if some is not
+       then the request is clamped to geometry that is on the screen.
+
+       Changed 'pixbuf' to 'art_pixbuf' in core function.
+
 1999-10-08  Michael Fulbright  <drmike@redhat.com>
 
        * src/gdk-pixbuf-data.c: Added to load rgb data from const data.
index 39697633033f35a2d73a76d173cecc3f2adbf403..aa7b9b1ed2a5d8bbeabe03d0f7b8fd28593ccbcc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * creates an ArtPixBuf from a Drawable
+ * Creates an GdkPixBuf from a Drawable
  *
  * Author:
  *   Cody Russell <bratsche@dfw.net>
@@ -21,7 +21,7 @@ gdk_pixbuf_from_drawable_core (GdkWindow *window,
                               gint with_alpha)
 {
        GdkImage *image;
-       ArtPixBuf *pixbuf;
+       ArtPixBuf *art_pixbuf;
        GdkColormap *colormap;
        art_u8 *buff;
        art_u8 *pixels;
@@ -30,9 +30,39 @@ gdk_pixbuf_from_drawable_core (GdkWindow *window,
        art_u8 r, g, b;
        gint xx, yy;
        gint fatness;
+       gint screen_width, screen_height;
+       gint window_width, window_height, window_x, window_y;
 
        g_return_val_if_fail (window != NULL, NULL);
 
+       screen_width = gdk_screen_width();
+       screen_height = gdk_screen_height();
+       gdk_window_get_geometry(window, NULL, NULL,
+                               &window_width, &window_height, NULL);
+       gdk_window_get_origin(window, &window_x, &window_y);
+
+       if(window_x < 0)
+       {
+               x = ABS(window_x);
+               width = window_width - x;
+       }
+       else
+       {
+               width = CLAMP(window_x + window_width, window_x,
+                               screen_width) - window_x;
+       }
+
+       if(window_y < 0)
+       {
+               y = ABS(window_y);
+               height = window_height - y;
+       }
+       else
+       {
+               height = CLAMP(window_y + window_height, window_y,
+                               screen_height) - window_y;
+       }
+
        image = gdk_image_get (window, x, y, width, height);
        colormap = gdk_rgb_get_cmap ();